package com.nya.roulette;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Stack;

import com.nya.roulette.JDKDActivity.State;

// Class GameState
// Keeps track of the entire game's stats and data structures.
public class GameState implements Serializable {

	private static final long serialVersionUID = 1L;
	public int chipCount;
	public int rating;
	public int spins;
	public int games;
	public int gameLoss;
	public State state;
	public ArrayList<Chip> chipsOnLayout;
	public Stack<ArrayList<Integer>> bettingStrat;
	public ArrayList<Integer> currentBet;
	
	public final int INITAL_CHIP_COUNT = 9;
	
	public GameState() {
	}
	
	@SuppressWarnings("unchecked")
	public GameState(GameState gameState) {
		this.chipCount = gameState.chipCount;
		this.rating = gameState.rating;
		this.spins = gameState.spins;
		this.games = gameState.games;
		this.gameLoss = gameState.gameLoss;
		this.state = gameState.state;
		this.chipsOnLayout = (ArrayList<Chip>) gameState.chipsOnLayout.clone();
		this.bettingStrat = (Stack<ArrayList<Integer>>) gameState.bettingStrat.clone();
		this.currentBet = (ArrayList<Integer>) gameState.currentBet.clone();
	}
	
	public void init() {
		chipCount = INITAL_CHIP_COUNT;
    	rating = 0;
    	spins = 0;
    	games = 0;
    	gameLoss = 0;
        state = State.ZERO;
        chipsOnLayout = new ArrayList<Chip>();
		bettingStrat = new Stack<ArrayList<Integer>>();
		currentBet = new ArrayList<Integer>();
	}
}